

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>saml2.logout_response &mdash; SAML Python library classes and methods</title>

    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />

    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="top" title="SAML Python library classes and methods" href="../../index.html" />
    <link rel="up" title="Class code" href="../index.html" />
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Class Index"
             >modules</a> |</li>
        <li><a href="../../index.html">SAML Python library classes and methods</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Class code</a> &raquo;</li>
      </ul>
    </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">

  <h1>Source code for saml2.logout_response</h1><div class="highlight"><pre>
<span class="c"># -*- coding: utf-8 -*-</span>


<span class="kn">from</span> <span class="nn">base64</span> <span class="kn">import</span> <span class="n">b64decode</span>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span>
<span class="kn">from</span> <span class="nn">lxml</span> <span class="kn">import</span> <span class="n">etree</span>
<span class="kn">from</span> <span class="nn">urllib</span> <span class="kn">import</span> <span class="n">quote_plus</span>
<span class="kn">from</span> <span class="nn">xml.dom.minidom</span> <span class="kn">import</span> <span class="n">Document</span><span class="p">,</span> <span class="n">parseString</span>

<span class="kn">import</span> <span class="nn">dm.xmlsec.binding</span> <span class="kn">as</span> <span class="nn">xmlsec</span>

<span class="kn">from</span> <span class="nn">saml2.constants</span> <span class="kn">import</span> <span class="n">OneLogin_Saml2_Constants</span>
<span class="kn">from</span> <span class="nn">saml2.utils</span> <span class="kn">import</span> <span class="n">OneLogin_Saml2_Utils</span>


<div class="viewcode-block" id="OneLogin_Saml2_Logout_Response"><a class="viewcode-back" href="../../saml2.html#saml2.logout_response.OneLogin_Saml2_Logout_Response">[docs]</a><span class="k">class</span> <span class="nc">OneLogin_Saml2_Logout_Response</span><span class="p">():</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">settings</span><span class="p">,</span> <span class="n">response</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Constructs a Logout Response object (Initialize params from settings</span>
<span class="sd">        and if provided load the Logout Response.</span>

<span class="sd">        Arguments are:</span>
<span class="sd">            * (OneLogin_Saml2_Settings)   settings. Setting data</span>
<span class="sd">            * (string)                    response. An UUEncoded SAML Logout</span>
<span class="sd">                                                    response from the IdP.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">__settings</span> <span class="o">=</span> <span class="n">settings</span>
        <span class="k">if</span> <span class="n">response</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">__logout_response</span> <span class="o">=</span> <span class="n">OneLogin_Saml2_Utils</span><span class="o">.</span><span class="n">decode_base64_and_inflate</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">document</span> <span class="o">=</span> <span class="n">parseString</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__logout_response</span><span class="p">)</span>

<div class="viewcode-block" id="OneLogin_Saml2_Logout_Response.get_issuer"><a class="viewcode-back" href="../../saml2.html#saml2.logout_response.OneLogin_Saml2_Logout_Response.get_issuer">[docs]</a>    <span class="k">def</span> <span class="nf">get_issuer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Gets the Issuer of the Logout Response Message</span>
<span class="sd">        :return: The Issuer</span>
<span class="sd">        :rtype: string</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">issuer</span> <span class="o">=</span> <span class="bp">None</span>
        <span class="n">issuer_nodes</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__query</span><span class="p">(</span><span class="s">&#39;/samlp:LogoutResponse/saml:Issuer&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">issuer_nodes</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">issuer</span> <span class="o">=</span> <span class="n">issuer_nodes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">text</span>
        <span class="k">return</span> <span class="n">issuer</span>
</div>
<div class="viewcode-block" id="OneLogin_Saml2_Logout_Response.get_status"><a class="viewcode-back" href="../../saml2.html#saml2.logout_response.OneLogin_Saml2_Logout_Response.get_status">[docs]</a>    <span class="k">def</span> <span class="nf">get_status</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Gets the Status</span>
<span class="sd">        :return: The Status</span>
<span class="sd">        :rtype: string</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">entries</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__query</span><span class="p">(</span><span class="s">&#39;/samlp:LogoutResponse/samlp:Status/samlp:StatusCode&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">entries</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">None</span>
        <span class="n">status</span> <span class="o">=</span> <span class="n">entries</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">attrib</span><span class="p">[</span><span class="s">&#39;Value&#39;</span><span class="p">]</span>
        <span class="k">return</span> <span class="n">status</span>
</div>
<div class="viewcode-block" id="OneLogin_Saml2_Logout_Response.is_valid"><a class="viewcode-back" href="../../saml2.html#saml2.logout_response.OneLogin_Saml2_Logout_Response.is_valid">[docs]</a>    <span class="k">def</span> <span class="nf">is_valid</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">request_data</span><span class="p">,</span> <span class="n">request_id</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Determines if the SAML LogoutResponse is valid</span>
<span class="sd">        :param request_id: The ID of the LogoutRequest sent by this SP to the IdP</span>
<span class="sd">        :type request_id: string</span>
<span class="sd">        :return: Returns if the SAML LogoutResponse is or not valid</span>
<span class="sd">        :rtype: boolean</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">idp_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__settings</span><span class="o">.</span><span class="n">get_idp_data</span><span class="p">()</span>
            <span class="n">idp_entity_id</span> <span class="o">=</span> <span class="n">idp_data</span><span class="p">[</span><span class="s">&#39;entityId&#39;</span><span class="p">]</span>
            <span class="n">get_data</span> <span class="o">=</span> <span class="n">request_data</span><span class="p">[</span><span class="s">&#39;get_data&#39;</span><span class="p">]</span>

            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">__settings</span><span class="o">.</span><span class="n">is_strict</span><span class="p">():</span>
                <span class="n">res</span> <span class="o">=</span> <span class="n">OneLogin_Saml2_Utils</span><span class="o">.</span><span class="n">validate_xml</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">document</span><span class="p">,</span> <span class="s">&#39;saml-schema-protocol-2.0.xsd&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">__settings</span><span class="o">.</span><span class="n">is_debug_active</span><span class="p">())</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">res</span><span class="p">,</span> <span class="n">Document</span><span class="p">):</span>
                    <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;Invalid SAML Logout Request. Not match the saml-schema-protocol-2.0.xsd&#39;</span><span class="p">)</span>

                <span class="n">security</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__settings</span><span class="o">.</span><span class="n">get_security_data</span><span class="p">()</span>

                <span class="c"># Check if the InResponseTo of the Logout Response matchs the ID of the Logout Request (requestId) if provided</span>
                <span class="k">if</span> <span class="n">request_id</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">document</span><span class="o">.</span><span class="n">documentElement</span><span class="o">.</span><span class="n">hasAttribute</span><span class="p">(</span><span class="s">&#39;InResponseTo&#39;</span><span class="p">):</span>
                    <span class="n">in_response_to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">document</span><span class="o">.</span><span class="n">documentElement</span><span class="o">.</span><span class="n">getAttribute</span><span class="p">(</span><span class="s">&#39;InResponseTo&#39;</span><span class="p">)</span>
                    <span class="k">if</span> <span class="n">request_id</span> <span class="o">!=</span> <span class="n">in_response_to</span><span class="p">:</span>
                        <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;The InResponseTo of the Logout Response: </span><span class="si">%s</span><span class="s">, does not match the ID of the Logout request sent by the SP: </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">in_response_to</span><span class="p">,</span> <span class="n">request_id</span><span class="p">))</span>

                <span class="c"># Check issuer</span>
                <span class="n">issuer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_issuer</span><span class="p">()</span>
                <span class="k">if</span> <span class="n">issuer</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">issuer</span> <span class="o">!=</span> <span class="n">idp_entity_id</span><span class="p">:</span>
                    <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;Invalid issuer in the Logout Request&#39;</span><span class="p">)</span>

                <span class="n">current_url</span> <span class="o">=</span> <span class="n">OneLogin_Saml2_Utils</span><span class="o">.</span><span class="n">get_self_url_no_query</span><span class="p">(</span><span class="n">request_data</span><span class="p">)</span>

                <span class="c"># Check destination</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">document</span><span class="o">.</span><span class="n">documentElement</span><span class="o">.</span><span class="n">hasAttribute</span><span class="p">(</span><span class="s">&#39;Destination&#39;</span><span class="p">):</span>
                    <span class="n">destination</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">document</span><span class="o">.</span><span class="n">documentElement</span><span class="o">.</span><span class="n">getAttribute</span><span class="p">(</span><span class="s">&#39;Destination&#39;</span><span class="p">)</span>
                    <span class="k">if</span> <span class="n">destination</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
                        <span class="k">if</span> <span class="n">current_url</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">destination</span><span class="p">:</span>
                            <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;The LogoutRequest was received at $currentURL instead of $destination&#39;</span><span class="p">)</span>

                <span class="k">if</span> <span class="n">security</span><span class="p">[</span><span class="s">&#39;wantMessagesSigned&#39;</span><span class="p">]:</span>
                    <span class="k">if</span> <span class="s">&#39;Signature&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">get_data</span><span class="p">:</span>
                        <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;The Message of the Logout Response is not signed and the SP require it&#39;</span><span class="p">)</span>

            <span class="k">if</span> <span class="s">&#39;Signature&#39;</span> <span class="ow">in</span> <span class="n">get_data</span><span class="p">:</span>
                <span class="k">if</span> <span class="s">&#39;SigAlg&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">get_data</span><span class="p">:</span>
                    <span class="n">sign_alg</span> <span class="o">=</span> <span class="n">OneLogin_Saml2_Constants</span><span class="o">.</span><span class="n">RSA_SHA1</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">sign_alg</span> <span class="o">=</span> <span class="n">get_data</span><span class="p">[</span><span class="s">&#39;SigAlg&#39;</span><span class="p">]</span>

                <span class="k">if</span> <span class="n">sign_alg</span> <span class="o">!=</span> <span class="n">OneLogin_Saml2_Constants</span><span class="o">.</span><span class="n">RSA_SHA1</span><span class="p">:</span>
                    <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;Invalid signAlg in the recieved Logout Response&#39;</span><span class="p">)</span>

                <span class="n">signed_query</span> <span class="o">=</span> <span class="s">&#39;SAMLResponse=</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">quote_plus</span><span class="p">(</span><span class="n">get_data</span><span class="p">[</span><span class="s">&#39;SAMLResponse&#39;</span><span class="p">])</span>
                <span class="k">if</span> <span class="s">&#39;RelayState&#39;</span> <span class="ow">in</span> <span class="n">get_data</span><span class="p">:</span>
                    <span class="n">signed_query</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">&amp;RelayState=</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">signed_query</span><span class="p">,</span> <span class="n">quote_plus</span><span class="p">(</span><span class="n">get_data</span><span class="p">[</span><span class="s">&#39;RelayState&#39;</span><span class="p">]))</span>
                <span class="n">signed_query</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">&amp;SigAlg=</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">signed_query</span><span class="p">,</span> <span class="n">quote_plus</span><span class="p">(</span><span class="n">sign_alg</span><span class="p">))</span>

                <span class="k">if</span> <span class="s">&#39;x509cert&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">idp_data</span> <span class="ow">or</span> <span class="n">idp_data</span><span class="p">[</span><span class="s">&#39;x509cert&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                    <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;In order to validate the sign on the Logout Response, the x509cert of the IdP is required&#39;</span><span class="p">)</span>
                <span class="n">cert</span> <span class="o">=</span> <span class="n">idp_data</span><span class="p">[</span><span class="s">&#39;x509cert&#39;</span><span class="p">]</span>

                <span class="n">xmlsec</span><span class="o">.</span><span class="n">initialize</span><span class="p">()</span>
                <span class="n">objkey</span> <span class="o">=</span> <span class="n">xmlsec</span><span class="o">.</span><span class="n">Key</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">cert</span><span class="p">,</span> <span class="n">xmlsec</span><span class="o">.</span><span class="n">KeyDataFormatPem</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>  <span class="c"># FIXME is this right?</span>

                <span class="k">if</span> <span class="ow">not</span> <span class="n">objkey</span><span class="o">.</span><span class="n">verifySignature</span><span class="p">(</span><span class="n">signed_query</span><span class="p">,</span> <span class="n">b64decode</span><span class="p">(</span><span class="n">get_data</span><span class="p">[</span><span class="s">&#39;Signature&#39;</span><span class="p">])):</span>
                    <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&#39;Signature validation failed. Logout Response rejected&#39;</span><span class="p">)</span>

            <span class="k">return</span> <span class="bp">True</span>
        <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
            <span class="n">debug</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__settings</span><span class="o">.</span><span class="n">is_debug_active</span><span class="p">()</span>
            <span class="k">if</span> <span class="n">debug</span><span class="p">:</span>
                <span class="k">print</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">strerror</span><span class="p">)</span>
            <span class="k">return</span> <span class="bp">False</span>
</div>
    <span class="k">def</span> <span class="nf">__query</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">query</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Extracts a node from the DOMDocument (Logout Response Menssage)</span>
<span class="sd">        :param query: Xpath Expresion</span>
<span class="sd">        :type query: string</span>
<span class="sd">        :return: The queried node</span>
<span class="sd">        :rtype: DOMNodeList</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="c"># Switch to lxml for querying</span>
        <span class="n">xml</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">document</span><span class="o">.</span><span class="n">toxml</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">OneLogin_Saml2_Utils</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">etree</span><span class="o">.</span><span class="n">fromstring</span><span class="p">(</span><span class="n">xml</span><span class="p">),</span> <span class="n">query</span><span class="p">)</span>

<div class="viewcode-block" id="OneLogin_Saml2_Logout_Response.build"><a class="viewcode-back" href="../../saml2.html#saml2.logout_response.OneLogin_Saml2_Logout_Response.build">[docs]</a>    <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">in_response_to</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Creates a Logout Response object.</span>
<span class="sd">        :param in_response_to: InResponseTo value for the Logout Response.</span>
<span class="sd">        :type in_response_to: string</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">sp_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__settings</span><span class="o">.</span><span class="n">get_sp_data</span><span class="p">()</span>
        <span class="n">idp_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__settings</span><span class="o">.</span><span class="n">get_idp_data</span><span class="p">()</span>

        <span class="n">uid</span> <span class="o">=</span> <span class="n">OneLogin_Saml2_Utils</span><span class="o">.</span><span class="n">generate_unique_id</span><span class="p">()</span>
        <span class="n">issue_instant</span> <span class="o">=</span> <span class="n">OneLogin_Saml2_Utils</span><span class="o">.</span><span class="n">parse_time_to_SAML</span><span class="p">(</span>
            <span class="nb">int</span><span class="p">(</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span><span class="p">))</span>
        <span class="p">)</span>

        <span class="n">logout_response</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;&lt;samlp:LogoutResponse xmlns:samlp=&quot;urn:oasis:names:tc:SAML:2.0:protocol&quot;</span>
<span class="s">                      xmlns:saml=&quot;urn:oasis:names:tc:SAML:2.0:assertion&quot;</span>
<span class="s">                      ID=&quot;</span><span class="si">%(id)s</span><span class="s">&quot;</span>
<span class="s">                      Version=&quot;2.0&quot;</span>
<span class="s">                      IssueInstant=&quot;</span><span class="si">%(issue_instant)s</span><span class="s">&quot;</span>
<span class="s">                      Destination=&quot;</span><span class="si">%(destination)s</span><span class="s">&quot;</span>
<span class="s">                      InResponseTo=&quot;</span><span class="si">%(in_response_to)s</span><span class="s">&quot;</span>
<span class="s">&gt;</span>
<span class="s">    &lt;saml:Issuer&gt;</span><span class="si">%(entity_id)s</span><span class="s">&lt;/saml:Issuer&gt;</span>
<span class="s">    &lt;samlp:Status&gt;</span>
<span class="s">        &lt;samlp:StatusCode Value=&quot;urn:oasis:names:tc:SAML:2.0:status:Success&quot; /&gt;</span>
<span class="s">    &lt;/samlp:Status&gt;</span>
<span class="s">&lt;/samlp:LogoutResponse&gt;&quot;&quot;&quot;</span> <span class="o">%</span> <span class="p">{</span>
            <span class="s">&#39;id&#39;</span><span class="p">:</span> <span class="n">uid</span><span class="p">,</span>
            <span class="s">&#39;issue_instant&#39;</span><span class="p">:</span> <span class="n">issue_instant</span><span class="p">,</span>
            <span class="s">&#39;destination&#39;</span><span class="p">:</span> <span class="n">idp_data</span><span class="p">[</span><span class="s">&#39;singleLogoutService&#39;</span><span class="p">][</span><span class="s">&#39;url&#39;</span><span class="p">],</span>
            <span class="s">&#39;in_response_to&#39;</span><span class="p">:</span> <span class="n">in_response_to</span><span class="p">,</span>
            <span class="s">&#39;entity_id&#39;</span><span class="p">:</span> <span class="n">sp_data</span><span class="p">[</span><span class="s">&#39;entityId&#39;</span><span class="p">],</span>
        <span class="p">}</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">__logout_response</span> <span class="o">=</span> <span class="n">logout_response</span>
</div>
<div class="viewcode-block" id="OneLogin_Saml2_Logout_Response.get_response"><a class="viewcode-back" href="../../saml2.html#saml2.logout_response.OneLogin_Saml2_Logout_Response.get_response">[docs]</a>    <span class="k">def</span> <span class="nf">get_response</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Returns a Logout Response object.</span>
<span class="sd">        :return: Logout Response deflated and base64 encoded</span>
<span class="sd">        :rtype: string</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="n">OneLogin_Saml2_Utils</span><span class="o">.</span><span class="n">deflate_and_base64_encode</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__logout_response</span><span class="p">)</span></div></div>
</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Class Index"
             >modules</a> |</li>
        <li><a href="../../index.html">SAML Python library classes and methods</a> &raquo;</li>
          <li><a href="../index.html" >Class code</a> &raquo;</li>
      </ul>
    </div>
    <div class="footer">
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>
